﻿/// <summary>
/// AbsESF_MetaObject【IESF_Global接口】
/// </summary>
public partial class AbsESF_MetaObject : IESF_Global
{
    #region IESF_IGlobal
    /// <summary>
    /// 全局唯一ID
    /// </summary>
    long mGlobalId = 0;
    /// <summary>
    /// 全局唯一ID
    /// </summary>
    public long globalId
    {
        get
        {
            if (mGlobalId == 0)
            {
                mGlobalId = ESF_GlobalUtility.ESF_NewGlobalUniqueId();
            }
            return mGlobalId;
        }
    }
    /// <summary>
    /// 修改GlobalId
    /// </summary>
    /// <param name="_globalId">要修改的Id</param>
    public void ModifyGlobalId(long _globalId)
    {
        long fromId = mGlobalId;
        OnBeforeModifyGlobalId(this, fromId, _globalId);
        mGlobalId = _globalId;
        OnAfterModifyGlobalId(this, fromId, _globalId);
    }

    /// <summary>
    /// 修改GlobalId之前
    /// </summary>
    /// <param name="_self">修改对象</param>
    /// <param name="_beforeId">修改前id</param>
    /// <param name="_afterId">修改后id</param>
    protected virtual void OnBeforeModifyGlobalId(IESF_Global _self, long _beforeId, long _afterId) { }
    /// <summary>
    /// 修改GlobalId之后
    /// </summary>
    /// <param name="_self">修改对象</param>
    /// <param name="_beforeId">修改前id</param>
    /// <param name="_afterId">修改后id</param>
    protected virtual void OnAfterModifyGlobalId(IESF_Global _self, long _beforeId, long _afterId) { }
    #endregion
}
